package com.aaa.system.controller.api;

import com.aaa.entity.SysDictData;
import com.aaa.security.annotation.HasPermission;
import com.aaa.security.annotation.MyLog;
import com.aaa.system.service.SysDictDataService;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
  #Description数据字典操作
 * @author 荆豪峰
 * @version 1.0
 * #Date: 2023/2/28 10:21
 */
@Api(value = "/system/sdd", tags = {"#Description数据字典操作 #Date: 2023/2/28 10:21"})
@RestController
@RequestMapping("/system/sdd")
public class ApiSysDictDataController {
     @Autowired
    private SysDictDataService sysDictDataService;
     /**
      * #Description 数据字典查询
      * @param currentPage
 * @param pageSize
 * @param sysDictData
      * @return com.aaa.vo.Result
      * @author 荆豪峰
      * #Date 2023/2/28
      */
     @ApiImplicitParams({
             @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
             @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
             @ApiImplicitParam(paramType = "body", dataType = "SysDictData", name = "sysDictData", value = "", required = true)
     })
     @ApiOperation(value = "#Description 数据字典查询 #Date 2023/2/28", notes = "#Description 数据字典查询 #Date 2023/2/28", httpMethod = "POST")
     @HasPermission(value = "dictData:search")
     @PostMapping("list")
     @MyLog(title="查询数据字典")
    public Result list( Integer currentPage, Integer pageSize,@RequestBody SysDictData sysDictData){
        return sysDictDataService.list(currentPage,pageSize,sysDictData);
    }
    /**
     * #Description 数据字典删除
     * @param dictCode
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "dictCode", value = "", required = true)
    })
    @ApiOperation(value = "#Description 数据字典删除 #Date 2023/2/28", notes = "#Description 数据字典删除 #Date 2023/2/28", httpMethod = "DELETE")
    @MyLog(title="添加数据字典")
    @HasPermission(value = "dictData:delete")
    @DeleteMapping("delete")
    public Result delete(Integer dictCode){
        return sysDictDataService.delete(dictCode);
    }
    /**
     * #Description 数据字典添加
     * @param sysDictData
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "SysDictData", name = "sysDictData", value = "", required = true)
    })
    @ApiOperation(value = "#Description 数据字典添加 #Date 2023/2/28", notes = "#Description 数据字典添加 #Date 2023/2/28", httpMethod = "POST")
    @MyLog(title="修改数据字典")
    @HasPermission(value = "dictData:insert")
    @PostMapping("insert")
    public Result insert(@RequestBody SysDictData sysDictData){
        return sysDictDataService.insert(sysDictData);
    }
    /**
     * #Description 数据字典修改
     * @param sysDictData
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "SysDictData", name = "sysDictData", value = "", required = true)
    })
    @ApiOperation(value = "#Description 数据字典修改 #Date 2023/2/28", notes = "#Description 数据字典修改 #Date 2023/2/28", httpMethod = "POST")
    @MyLog(title="更新数据字典")
    @HasPermission(value = "dictData:update")
    @PostMapping("update")
    public Result update(@RequestBody SysDictData sysDictData) {
        return sysDictDataService.update(sysDictData);
    }
    /**
     * #Description 数据字典批量删除
     * @param dictCode
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/2/28
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String[]", name = "dictCode", value = "", required = true)
    })
    @ApiOperation(value = "#Description 数据字典批量删除 #Date 2023/2/28", notes = "#Description 数据字典批量删除 #Date 2023/2/28", httpMethod = "POST")
    @MyLog(title="批量删除数据字典")
    @HasPermission(value = "dictData:delete")
    @PostMapping("/deletes")
    public Result deletes(String[] dictCode){

        return sysDictDataService.deletes(dictCode);
    }
}
